<?php

namespace app\product\controller;
use app\common\controller\PCBase;
use app\common\controller\DBase;
use app\common\library\Upload;
use app\product\logic\ProductNewLogic;
use  think\App;
class ProductNew extends PCBase
{

    /**
     * @desc   获取产品库存列表
     * @author luckyXiong
     * @date   2024-07-24
     */
    public function index(){
        $params     = $this->request->post();
        return  (new ProductNewLogic())->getList($params);
    }



    /**
     * @desc   产品上新数据导入
     * @author luckyXiong
     * @date   2024-07-24
     */
    public function importProduct(){
        $file       = $this->request->file('file');
        $res        = (new Upload($file))->upload(null, $this->getAdminId());
        (new ProductNewLogic())->import_info($res['url']);
        return  $this->jsonMessage(200, true, '操作成功',null);
    }


    /**
     * @desc   产品上新新增
     * @author luckyXiong
     * @date   2024-07-24
     */
    public function add(){
        $params     = $this->request->post();
        return       (new ProductNewLogic())->add_info($params);
    }



    /**
     * @desc   产品上新详情
     * @author luckyXiong
     * @date   2024-07-24
     */
    public function find(){
        $params     = $this->request->post();
        return       (new ProductNewLogic())->get_info($params);
    }


    /**
     * @desc   上新编辑接口
     * @author luckyXiong
     * @date   2024-07-25
     */
    public function edit(){
        $params     = $this->request->post();
        return       (new ProductNewLogic())->edit_info($params);
    }


    /**
     * @desc   产品审核接口
     * @author luckyXiong
     * @date   2024-07-25
     */
    public function check(){
        $params     = $this->request->post();
        return       (new ProductNewLogic())->check_info($params);
    }







    /**
     * @desc   产品上新数据导入
     * @author luckyXiong
     * @date   2024-07-24
     */
    public function testImportConsumer(){
        $params   = $this->request->post();
        $res      = (new ProductNewLogic())->uploadProductConsumer($params);
        return    $this->jsonMessage(200,true,'操作成功!',$res);
    }















}